#include "bsp.h"

#include "os.h"
#include "app_cfg.h"

static  OS_TCB   AppLEDTCB;
static  CPU_STK  AppLEDStk[APP_CFG_TASK_START_STK_SIZE];


void Task_LED(void *arg){
	OS_ERR      err;
	while(1)
	{
		GPIO_ResetBits(GPIOF,GPIO_Pin_9);
		OSTimeDly(500, OS_OPT_TIME_DLY, &err);
		GPIO_SetBits(GPIOF,GPIO_Pin_9);
		OSTimeDly(500, OS_OPT_TIME_DLY, &err);
	}
}

int main(void)
{   
	OS_ERR  err;

	bsp_init();

	/* Init uC/OS-III. */
	OSInit(&err);                                             

	/* Create the start task */
	OSTaskCreate((OS_TCB       *)&AppLEDTCB,              
					(CPU_CHAR     *)"App Task Start",
					(OS_TASK_PTR   )Task_LED, 
					(void         *)0,
					(OS_PRIO       )APP_CFG_TASK_START_PRIO,
					(CPU_STK      *)&AppLEDStk[0],
					(CPU_STK_SIZE  )APP_CFG_TASK_START_STK_SIZE / 10,
					(CPU_STK_SIZE  )APP_CFG_TASK_START_STK_SIZE,
					(OS_MSG_QTY    )0,
					(OS_TICK       )0,
					(void         *)0,
					(OS_OPT        )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
					(OS_ERR       *)&err);

	/* Start multitasking (i.e. give control to uC/OS-III). */
	OSStart(&err);                                   
	(void)&err;
	return (0);

}



